﻿using Orleans;
using Pay.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Pay.Model.Dto;
using Pay.Model.Interfaces;
using Pay.Container;
using Pay.Dal;
using Pay.Model;

namespace Pay.ServiceImplement
{
    public class QRCodeServiceImplement : Grain, IQRCodeService
    {
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task<bool> Delete(QRCodeInfo model)
        {
            var instance = LocManager.Resolve<IQRCodeDal>();
            return await instance.Delete(model);
        }

        public async Task<QRCodeInfo> GetById(long id)
        {
            var instance = LocManager.Resolve<IQRCodeDal>();
            return await instance.GetById(id);
        }

        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="searchAccount"></param>
        /// <param name="timeBegin"></param>
        /// <param name="timeEnd"></param>
        /// <param name="offset"></param>
        /// <param name="rows"></param>
        /// <returns></returns>
        public async Task<IPagedOutput<QRCodeOutPut>> GetPage(string searchAccount, DateTime? timeBegin = null, DateTime? timeEnd = null, int offset = 10, int rows = 1)
        {
            var instance = LocManager.Resolve<IQRCodeDal>();
            return await instance.GetPage(searchAccount, timeBegin, timeEnd, offset, rows);
        }
    }
}
